<div id="confirm" v-show="show">
    <div class="weui-mask"></div>
    <div class="weui-dialog">
        <div class="weui-dialog__hd"><strong class="weui-dialog__title">@{{ title }}</strong></div>
        <div class="weui-dialog__bd">@{{ content }}</div>
        <div class="weui-dialog__ft">
            <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_default" v-on:click="show = false">@{{ cancel }}</a>
            <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary" v-on:click="ok">@{{ confirm }}</a>
        </div>
    </div>
</div>
@include('app.partial.loading')
<script>
    var confirmComponent = new Vue({
        el: '#confirm',
        data: {
            show: false,
            title: '',
            content: '',
            cancel: '取消',
            confirm: '确定',
            callback: '',
            loadingMsg: ''
        },
        methods: {
            showConfirm: function(title, content, callback, loadingMsg, confirm, cancel){
                this.title = title;
                this.content = content;
                this.confirm = confirm ? confirm : this.confirm;
                this.cancel = cancel ? cancel : this.cancel;
                this.callback = callback;
                this.show = true;
            },
            ok: function(){
                this.show = false;
                loading.showLoading(this.loadingMsg);
                this.callback();
            }
        }
    })
</script>